package aps

import grails.transaction.Transactional

import javax.jms.JMSException
import javax.jms.Message
import javax.jms.MessageListener
import javax.jms.TextMessage

/**
 * j
 */
@Transactional
class ComsumerListenerService implements MessageListener{

    @Override
    public void onMessage(Message message) {
        System.out.println("进入监听");
        try {
            TextMessage textMessage = (TextMessage) message;
            //取消息内容
            if (textMessage){
                String text = textMessage.getText();
                System.out.println(text);
            }

        } catch (JMSException e) {
            e.printStackTrace();
        }
    }
}
